extends CharacterBody2D

@export var attack_params : Dictionary = {
	damage = 5.0
}
const SPEED = 100.0

func _ready():
	pass

func _physics_process(_delta):
	var current_scene = get_tree().current_scene
	var is_paused = current_scene.is_paused
	if is_paused : return
	var actor_list = current_scene.actor_list
	if actor_list.get_child_count() > 0 :
		var actor = actor_list.get_child(0)
		if (global_position - actor.global_position).length() > 50.0 :
			velocity = (actor.global_position - global_position).normalized() * SPEED
		else :
			velocity = Vector2.ZERO
	else :
		velocity = Vector2.ZERO
	move_and_slide()

func _on_attack() :
	pass

func _hurt(params : Dictionary) :
	print(params.damage)
	pass
